package com.ruoyi.ihome.service.impl;

import java.util.List;

import com.ruoyi.common.core.redis.RedisCache;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.ihome.mapper.IhHomeTagMapper;
import com.ruoyi.ihome.domain.IhHomeTag;
import com.ruoyi.ihome.service.IIhHomeTagService;

/**
 * 房间标签Service业务层处理
 * 
 * @author NING
 * @date 2024-08-12
 */
@Service
public class IhHomeTagServiceImpl implements IIhHomeTagService 
{
    @Autowired
    private IhHomeTagMapper ihHomeTagMapper;

    @Autowired
    private RedisCache redisCache;

    /**
     * 查询房间标签
     * 
     * @param id 房间标签主键
     * @return 房间标签
     */
    @Override
    public IhHomeTag selectIhHomeTagById(Long id)
    {
        return ihHomeTagMapper.selectIhHomeTagById(id);
    }

    /**
     * 查询房间标签列表
     * 
     * @param ihHomeTag 房间标签
     * @return 房间标签
     */
    @Override
    public List<IhHomeTag> selectIhHomeTagList(IhHomeTag ihHomeTag)
    {
        if(ihHomeTag != null)
            return ihHomeTagMapper.selectIhHomeTagList(ihHomeTag);
        List<IhHomeTag> list = (List<IhHomeTag>) redisCache.getCacheObject("selectIhHomeTagList");
        if (list == null){
            list = ihHomeTagMapper.selectIhHomeTagList(ihHomeTag);
            redisCache.setCacheObject("selectIhHomeTagList",list);
        }
        return list;
    }

    /**
     * 新增房间标签
     * 
     * @param ihHomeTag 房间标签
     * @return 结果
     */
    @Override
    public int insertIhHomeTag(IhHomeTag ihHomeTag)
    {
        return ihHomeTagMapper.insertIhHomeTag(ihHomeTag);
    }

    /**
     * 修改房间标签
     * 
     * @param ihHomeTag 房间标签
     * @return 结果
     */
    @Override
    public int updateIhHomeTag(IhHomeTag ihHomeTag)
    {
        return ihHomeTagMapper.updateIhHomeTag(ihHomeTag);
    }

    /**
     * 批量删除房间标签
     * 
     * @param ids 需要删除的房间标签主键
     * @return 结果
     */
    @Override
    public int deleteIhHomeTagByIds(Long[] ids)
    {
        return ihHomeTagMapper.deleteIhHomeTagByIds(ids);
    }

    /**
     * 删除房间标签信息
     * 
     * @param id 房间标签主键
     * @return 结果
     */
    @Override
    public int deleteIhHomeTagById(Long id)
    {
        return ihHomeTagMapper.deleteIhHomeTagById(id);
    }
}
